/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kontrol;

import Master.GolonganDarah;
import Master.JenisKelamin;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import Model.KK;
import Model.Pasien;
import Master.Penyakit;
import Model.Rekam;
import Master.Tindakan;
import Koneksi.Koneksi;

/**
 *
 * @author BIMO
 */
public class kontrolPemeriksaan {

    ResultSet rs = null;
    PreparedStatement pst = null;
    private Connection conn;

    public kontrolPemeriksaan(Connection koneksi) {
        this.conn = koneksi;
    }

    public static kontrolPemeriksaan getkoneksi() throws SQLException {
        kontrolPemeriksaan kon = new kontrolPemeriksaan(Koneksi.ConnectDb());

        return kon;
    }

    public List<Penyakit> lihatPenyakit(String namaPenyakit) throws SQLException {
        PreparedStatement statement = null;
        ResultSet result = null;

        conn.setAutoCommit(false);
        statement = conn.prepareStatement("SELECT * from penyakit "
                + "where golongansebabsakit like '%" + namaPenyakit + "%'");
        result = statement.executeQuery();
        List<Penyakit> kategoris = new ArrayList<Penyakit>();
        while (result.next()) {
            Penyakit kategori = new Penyakit();
            kategori.setNoDTD(result.getString("noDTD"));
            kategori.setGolSebabSakit(result.getString("golonganSebabSakit"));
            kategoris.add(kategori);
        }
        conn.commit();
        return kategoris;

    }
}
